package tr.edu.metu.is.mega.client.schedule;

import java.util.List;

import tr.edu.metu.is.mega.client.core.SelectionDialog;
import tr.edu.metu.is.mega.common.dto.ScheduleTemplateDTO;

import com.extjs.gxt.ui.client.widget.LayoutContainer;

/**
 * Selection Dialog for {@link ScheduleTemplateDTO} records.
 * 
 */
public class ScheduleTemplateSelectDialog extends SelectionDialog<ScheduleTemplateDTO> {

    private ScheduleTemplateSelectWindow selectWindow;

    /**
     * Default constructor.
     * 
     * @param multiSelect set true to enable multi selection.
     * @param editEnabled set true to enable edit record.
     */
    public ScheduleTemplateSelectDialog(boolean multiSelect, boolean editEnabled) {
        super(multiSelect, editEnabled);
        setHeading("Select Template");
        setSize(300, 500);

    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected List<ScheduleTemplateDTO> getSelectedItems() {
        return selectWindow.getSelectedItems();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void setSelectedItems(List<ScheduleTemplateDTO> selectedItems) {
        selectWindow.setSelectedItems(selectedItems);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected LayoutContainer getSelectionWidget(Object... parameters) {
        selectWindow = new ScheduleTemplateSelectWindow();
        return selectWindow;
    }
}
